package com.oocl.crm.command.receiver;

import com.oocl.crm.command.BaseReceiver;
import com.oocl.crm.exception.CrmException;

public class ShowHelpReceiver extends BaseReceiver {

	public ShowHelpReceiver(String[] commandSplit) {
		super(commandSplit);
	}

	@Override
	public String action() throws CrmException {
		String result = "\n";
		result += "--------------------------- Welcome to CRM! ---------------------------\n";
		result += "|                                                                     |\n";
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("L")) {
		result += "| L: Query the customers' information                                 |\n";
		result += "|    (L -> list all customers)                                        |\n";
		result += "|    (L name:Sam,sex:Male -> list corresponding customers)            |\n";
		}
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("A")) {
		result += "| A: Add a customer (Example: A name:Max,sex:Male,......)             |\n";
		}
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("D")) {
		result += "| D: Delete a customer by id (Exemple: D 123)                         |\n";
		}
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("U")) {
		result += "| U: Update a customer's information by id (Example: U 234 name:Neal) |\n";
		}
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("O")) {
		result += "| O: Sort customers                                                   |\n";
		result += "|    (O id -> sort by id; O name -> sort by name)                     |\n";
		}
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("H")) {
		result += "| H: Show help of commands                                            |\n";
		result += "|    (H -> help of all commands)                                      |\n";
		result += "|    (H A -> help command A), etc.                                    |\n";
		}
		if (commandSplit == null || commandSplit.length < 2 || commandSplit[1].equals("Q")) {
		result += "| Q: Quit the system                                                  |\n";
		}
		result += "|                                                                     |\n";
		result += "-----------------------------------------------------------------------";
		return result;
	}

}
